package legacy.test;

import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;



public class starter {
	static boolean  oldStart = true;
    /**
     * @param args
     */
    @SuppressWarnings("deprecation")
	public static void main(String[] args) {
    	if(oldStart){
	    	File heldenjar = new File("D:/helden.jar");
	//      File clientjar = new File("I:/DSA-Tools/helden-client.jar");
	        URL[] urls;
	        try {
	        	urls = new URL[] { heldenjar.toURL()/*, clientjar.toURL()*/ };
	  	        URLClassLoader cl = new URLClassLoader(urls);
	  	        //  Load in the class
	  	        Class< ? > cls = cl.loadClass(RmtClient.class.getName());//"rmi.client.RmtClient"
	  	        Constructor< ? > constructor = cls.getConstructor(new Class[] {String.class, String.class});
	  	        constructor.newInstance(new Object[] {"localhost", "RmiHeldenServer"});
	  	        //        constructor.newInstance(new Object[] {"localhost:1099", "RmiHeldenServer"});
			} catch (MalformedURLException e) {            
			    e.printStackTrace();
			} catch (ClassNotFoundException e) {
			    e.printStackTrace();
			} catch (SecurityException e) {
			    e.printStackTrace();
			} catch (NoSuchMethodException e) {        
			    e.printStackTrace();
			} catch (IllegalArgumentException e) {          
			    e.printStackTrace();
			} catch (InstantiationException e) {            
			    e.printStackTrace();
			} catch (IllegalAccessException e) {           
				e.printStackTrace();
			} catch (InvocationTargetException e) {           
				e.printStackTrace();
			}
    	}else{
    		@SuppressWarnings("unused")
			RmtClient client = new RmtClient("localhost", "RmiHeldenServer");
    		
    	}        
    }

}
